
public class Board {
	/**
	 * Called by Game class
	 * 
	 * @author Larry Savago
	 * @author Casey Huckins
	 * @date 4/13/2012
	 */
	static final int ROWS = 9;
	static final int COLS = 9;
	private Square[] ideal = new Square[(COLS/Ship.SIZE)*ROWS];
	private Square[][] board = new Square[ROWS][COLS];
	
	// set square ids for trouble shooting
	public Board() {
		int pos = 0;
		int i;
		for (i=0;i<ROWS;i++){
			for (int p=0; p<COLS;p++){
				board[i][p] = new Square();
				board[i][p].setId(i,p);
				// build ideal search array example 27 squares for 9x9
				if (p%Ship.SIZE == i%Ship.SIZE) {
					ideal[pos]=board[i][p];
					pos++;
				}
			}
		}
	}
	public Square getSquare(int row, int col) {
		return board[row][col];
	}
	
	public void setSquare(int row, int col, Square s) {
		board[row][col] = s;
	}
	
	public Square[] getIdeal() {
		return ideal;
	}

	public String toString() {
		String s = "";
		for (int i=0;i<ROWS;i++){
			for (int p=0; p<COLS;p++){
				s = s + board[i][p].toString();
			}
			s = s + "\n";
		}
		return s;
	}
}